<%--
*
* 描述：顶部文件
*
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.toncen.samepms.system.domain.Module"/>
<jsp:directive.page import="com.toncen.samepms.common.AbstractAction"/>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title></title>
	<%@include file="/share/header.jsp"%>
	<link href="<%=path%>/main/dsnc/css/frameCommon.min.css" rel="stylesheet" type="text/css">
	<s:head/>
	<!--[if IE 6]>
	<style type="text/css">
		div.topMenuListHover{background-image:none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<%=path%>/main/dsnc/image/top_menu_list_hover.png',sizingMethod="scale");}
		div.topMenuListSelected{background-image:none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<%=path%>/main/dsnc/image/top_menu_list_selected.png',sizingMethod="scale");}
	</style>
	<![endif]-->
</head>

<body onload="onDoLoad()">
<div class="top">
  <div class="logo"></div>
  <div class="topMenu">
  <%
  	Object modules=session.getAttribute(AbstractAction.MODULE_SESSION_ATTRIBUTE);//获取session中保存的功能权限
  	if(modules==null){
  		throw new Exception("未设置当前登录用户的功能权限，请与系统管理员联系！");
  	}
  	List<Module>  moduleList = (List)modules;
  	int count=0;
  	Module first=null;
  	for(Module module:moduleList){//遍历一级模块
		count++;
		if(count==1){
			first=module;
		}
  %>
    <div id="<%=module.getId()%>" class="<%=first.getId()==module.getId()?"topMenuListSelected":"topMenuList"%>"  title="<%=module.getName()%>"  onclick="onDoMenu(<%=module.getId()%>,'<%=module.getName()%>','<%=module.getLinkUrl()%>')">
      <div class="topMenuImg"><img src="<%=path+module.getIcon()%>"></div>
      <div class="topMenuText"><%=module.getName()%></div>
    </div>  
  <%
  	}
  %>
  </div>
  <div class="systemFun">
    <div class="systemFunLeft"></div>
    <div class="systemFunMid">
      <s:if test="getConfigValue('enable_portal')==\"1\"">
        <a title="门户网站主页" onclick="window.open('<%=path%>/index.jsp','portal')" ><img src="<%=path%>/main/dsnc/image/icon_home.png" width="24" height="16"></a>
      <div class="systemFunLine"></div>
      </s:if>    
        <a title="个性化设置" onclick="onDoSkinconfiguration()"><img src="<%=path%>/main/dsnc/image/icon_custom.png" width="24" height="16"></a>
      <div class="systemFunLine"></div>
 		<a title="在线用户" onclick="onDoOnlineUser()"><img src="<%=path%>/main/dsnc/image/icon_onlineuser.png" width="24" height="16"></a>
      <div class="systemFunLine"></div>
 		<a title="QQ客服"  onclick="window.open('http://wpa.qq.com/msgrd?V=1&Uin=<s:property value="getConfigValue('supporte_qq')"/>&Menu=yes','_blank')" ><img src="<%=path%>/main/dsnc/image/qq.png" width="20" height="20"></a> 		
      <div class="systemFunLine"></div>
        <a title="在线帮助"><img src="<%=path%>/main/dsnc/image/icon_help.png" width="24" height="16"></a>
    </div>
    <div class="systemFunRight"></div>
  </div>
</div>
<script>
	function onDoLoad(){
		<%if(first!=null){%>
			//onDoMenu(<%=first.getId()%>,'<%=first.getName()%>','<%=first.getLinkUrl()%>');
			if(top.indexFrame.leftFrame!=null){
				top.indexFrame.leftFrame.document.location.replace('<s:url action="left_dsnc" namespace="/main" />?menuId=<%=first.getId()%>');
			}			
		<%}%>
	}
	function onDoMenu(menuId,moduleTitle,url){
		//去除选中的
		$(".topMenuListSelected").addClass("topMenuList"); //已经选中的设置为未选中
		$(".topMenuListSelected").removeClass("topMenuListSelected"); //移除已经选中的
		$(".topMenuList").mouseover(function(){this.className='topMenuListHover';});
		$(".topMenuList").mouseout(function(){this.className='topMenuList';});
		//当前设置选中
		$("#"+menuId).unbind('mouseover');
		$("#"+menuId).unbind('mouseout');			
		$("#"+menuId).removeClass("topMenuList"); //当前菜单移除未选中状态
		$("#"+menuId).removeClass("topMenuListHover"); //当前菜单移除未选中状态
		$("#"+menuId).addClass("topMenuListSelected"); //当前菜单设置为已选中
		loading('<br><br><img src="<%=path%>/image/loading.gif" ><br>我正在打开菜单【'+moduleTitle+'】中，请稍候...<br><br>');
		if(top.indexFrame.leftFrame!=null){
			top.indexFrame.leftFrame.document.location.replace('<s:url action="left_dsnc" namespace="/main" />?menuId='+menuId);
		}
		if(top.indexFrame.mainFrame!=null&&top.indexFrame.mainFrame.onDoModule!=null){
			top.indexFrame.mainFrame.onDoModule(menuId,moduleTitle,moduleTitle,url);
		}
	}
	function onDoOnlineUser(){
		var options={
			title:'在线用户',
			url:'<s:url action="onlineuser_dsnc" namespace="/main" />',
			source : window,
			buttons:[top.MyWindow.Close],
			multiplewidth:1,
			multipleheight:1,
			tipstitle:'',
			tipscontent:''
		};
		top.MyWindow.open(options);			
	}
	function onDoSkinconfiguration(){
		var options={
			title:'个性化设置',
			url:'<s:url action="edit" namespace="/system/skinconfiguration" />',
			source : window,
			buttons:[top.MyWindow.Save,top.MyWindow.Close],
			multiplewidth:1,
			multipleheight:1,
			tipstitle:'',
			tipscontent:'修改成功后下次登录才会生效；'
		};
		top.MyWindow.open(options);			
	}
</script>
</body>
</html>
